﻿/*
	2017/4/14 bug:进卡模式：开关+磁信号 （已修复）
 */

#include "uartApi.h"
#include <dlfcn.h>
#include "head.h"

#include "TYRMCOMMU10.H"
char msg[1024] = {0};
int  InitReadCarder()
{
	ret = OpenDevice(readCard_path,msg);//打开设备
	if(ret == 0)
	{
		printf("open readCardDevice succees!\n");
	}
	else
	{
		printf("open readCardDevice ERROR!\n");
	}
	ret = InitDevice(2,msg);//初始化
	if(ret < 0)
	{
		//如果初始化失败，
		printf("readCard initDeice error !\n");
		return -1;
	}
	return 0;
}
void *Card_Reader(void *args)
{

	int cardStatus;
	int ret;
	char ReData[1024] = {0};
	char sendQtDate[1024] = {"member:"};
	
	
	ret = CallEntry(msg);//允许插卡
	do
	{
	ret = GetDeviceStatus(&cardStatus,msg);//卡的状态
	}while(cardStatus != 2);
	ret = ReadTracks(2,ReData,msg); //读取第二磁道
	printf("readcardId :  %s\n",ReData);
	ret = Eject(msg);//禁止进卡
	return;

}



